#!/usr/bin/python 
# -*- coding: utf-8 -*-
import  random;
import os,sys;


def fun_readFile(v_filePath,v_str):
    open_file = open(v_filePath,'r')
    for f_line in open_file:
        if f_line[0:len(f_line)-1] == v_str:
            v_return = '0'
            v_result ='输入密码正确！'
            break
        else:
            v_return = '-1'
            v_result ='输入密码错误！'
    open_file.close()
    return  v_return,v_result


if __name__ == '__main__':
    v_num = 0
    v_filePath = 'C:\\text_4.txt'   #将text_4.txt文本文件放在C盘根目录下
    while True:
        v_str = raw_input('\n 请输入密码：')
        v_return,v_result = fun_readFile(v_filePath,v_str)
        v_num =v_num + 1
        if v_return == '0':
            break
        else:
            if v_num == 3:
                break
    print str(v_num) + '次' + v_result








